ffmpeg notes
ffmpeg -i "$i" \
-codec:v libx265 \
-codec:a aac \
-vf format=pix_fmts=yuv420p \
-threads 0 \
-ac 2 \
-sn \
-movflags faststart \
-preset slow \
"out/${i%.*}.mp4"
ffmpeg -i "$i" \
-codec:v h264 \
-codec:a aac \
-vf format=pix_fmts=yuv420p \
-threads 0 \
-ac 2 \
-sn \
-movflags faststart \
-preset slow \
"out/${i%.*}.mp4"
ffmpeg -i clash-orig.mp4 \
-codec:v h264 \
-codec:a aac \
-vf format=pix_fmts=yuv420p \
-threads 0 \
-ac 2 \
-c:s mov_text \
-movflags faststart \
-preset slow \
clash.mp4
for i in *.avi; do ffmpeg -i "$i" "${i%.*}.mp4"; done
for i in *.mkv; do ffmpeg -i "$i" -vcodec h264 -acodec aac -strict -2 -c:s mov_text "${i%.*}.mp4"; done
for i in *.mp4; do ffmpeg -i "$i" -i "Subs/${i%.*}/11_English.srt" -vcodec h264 -acodec aac -preset slow -crf 23 -vf "scale=trunc(iw/2)*2:trunc(ih/2)*2" -pix_fmt yuv420p -bufsize 1000k -b: a 128k -y -c:s mov_text -disposition:s:0 default "out/${i%.*}.mp4"; done
for i in *.mkv
do
ffmpeg -i "$i" \
-c:v h264 \
-c:a aac \
-preset slow \
-crf 23 \
-vf "scale=trunc(iw/2)*2:trunc(ih/2)*2" \
-pix_fmt yuv420p \
-bufsize 1000k \
-b:a 128k \
-y \
-c:s mov_text \
-movflags +faststart \
-disposition:s:0 default \
"out/${i%.*}.mp4"
done
for i in *.mkv
do
ffmpeg -i "$i" \
-codec:video h264 \
-codec:audio aac \
-preset slow \
-crf 23 \
-pix_fmt yuv420p \
-bitrate:audio 128k \
-movflags +faststart \
"out/${i%.*}.mp4"
break
done
for i in *.mkv
do
ffmpeg -i "$i" \
-c:v h264 \
-b:v 15M \
-c:a aac \
-b:a 128k \
-crf 23 \
-pix_fmt yuv420p \ # -vf format=yuv420p
-movflags +faststart \
-preset slow \
-profile:v baseline \
"out/${i%.*}.mp4"
break
done
ffmpeg -i clash-orig.mp4 -codec:v h264 -codec:a aac -vf format=pix_fmts=yuv420p -threads 0 -ac 2 -c:s mov_text -movflags faststart -preset slow clash.mp4
Options:
- removes subtitles: -sn
- downmix audio to two channels (https://superuser.com/a/1410620): -ac 2
- video codec: h264 or libx265
- copy subtitles: -c:s mov_text